Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

perf(isArray): use native Array.isArray #7735

Closed
wants to merge 1 commit into from

Conversation

sebholstein
Copy link
Contributor

Request Type: perf

How to reproduce:

Component(s): misc core

Impact: small

Complexity: small

This issue is related to:

Detailed Description:

Other Comments:

see benchmark: http://jsperf.com/isarray-performance

return toString.call(value) === '[object Array]';
};
}
return function(value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return Array.isArray; --- this is a static and doesn't depend on being attached to the Array constructor

@caitp
Copy link
Contributor

caitp commented Jun 6, 2014

LGTM with comments addressed

@sebholstein
Copy link
Contributor Author

@caitp thanks for your comments, done!

@caitp
Copy link
Contributor

caitp commented Jun 6, 2014

For a minor edit (just to make sure toString actually exists) http://jsperf.com/isarray-performance/2

I get pretty good results (with --enable-benchmarking flag set), so I retract my previous statement about the old way being faster on occasion, which has since been deleted.

@IgorMinar
Copy link
Contributor

lgtm

@btford
Copy link
Contributor

btford commented Jun 6, 2014

👍

@caitp caitp closed this in 751ebc1 Jun 7, 2014
@caitp
Copy link
Contributor

caitp commented Jun 7, 2014

merg'd~

@btford
Copy link
Contributor

btford commented Jun 7, 2014

👯

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants